package swissmap;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class Constants {

	public static String basePath;
										//G:\tmp\TopoMap1.2\France_Mainland\Zoom_8\Rectangles_256_256
	public static String basePathCana="G:\\tmp\\TopoMap1.2\\Spain_Canarics\\";
	public static String basePathFrance="G:\\tmp\\TopoMap1.2\\France_Mainland\\";
	public static String basePathGermany="G:\\tmp\\TopoMap1.2\\Germany\\";

	
	public static String fileFormat="jpg";
	//="F:\\tmp\\swiss_map_test\\";
	//public static String basePath="/Users/ripper/java/swiss_map_download/data/";
	
public static Map<String, Integer> res=new HashMap<String, Integer>();


public static Map<String, Integer> dimx_end=new HashMap<String, Integer>();
public static Map<String, Integer> dimy_end=new HashMap<String, Integer>();
public static Map<String, Integer> dimx_start=new HashMap<String, Integer>();
public static Map<String, Integer> dimy_start=new HashMap<String, Integer>();

public static Map<String, Integer> dimx_end_max=new HashMap<String, Integer>();
public static Map<String, Integer> dimy_end_max=new HashMap<String, Integer>();

public static Map<String, Origin> origin=new HashMap<String, Origin>();

public static final String[] res_arr={"10k","20k","25k","50k"};


/**
 * map=1 normal map
 * map=0 photomap
 */
public static boolean map=false;


static{	
	//System.out.println(System.getProperty("os.name"));
	if(System.getProperty("os.name").equals("Windows XP") || System.getProperty("os.name").equals("Windows 7")){
		basePath="F:\\tmp\\swiss_map_test\\";
		//basePathFrance="F:\\tmp\\france_map_test\\";
	}else{
		basePath="/Users/ripper/java/swiss_map_download/data/";
	}
		
	
	res.put("10k", 22);
	res.put("20k", 21);
	res.put("25k", 20);
	res.put("50k", 19);
	res.put("100k", 18);	//row 22
	res.put("200k", 17);
	
	File f;
	for(String k:res.keySet()){
		f=new File(basePath+"raw"+File.separator+"map"+File.separator+k+File.separator);
		if(!f.exists()){
			f.mkdirs();
		}
		f=new File(basePath+"raw"+File.separator+"ortho"+File.separator+k+File.separator);
		if(!f.exists()){
			f.mkdirs();
		}
	}
	



	
dimx_end_max.put("10k", 749);
dimy_end_max.put("10k", 499);
dimx_end_max.put("20k",374 );
dimy_end_max.put("20k",249 );
dimx_end_max.put("25k", 187);
dimy_end_max.put("25k", 124);
dimx_end_max.put("50k", 93);
dimy_end_max.put("50k", 62);
dimx_end_max.put("100k", 37); //34
dimy_end_max.put("100k", 24); //21

dimx_end_max.put("200k", 18); 
dimy_end_max.put("200k", 12); 


dimx_start.put("10k", 93);
dimy_start.put("10k", 68);

dimx_start.put("20k", 46);
dimy_start.put("20k", 25);
dimx_start.put("25k", 23);
dimy_start.put("25k", 12);
dimx_start.put("50k", 8);
dimy_start.put("50k", 2);
dimx_start.put("100k", 4); 
dimy_start.put("100k", 2);

dimx_start.put("200k", 2); 
dimy_start.put("200k", 1); 



dimx_end.put("10k", 667);
dimy_end.put("10k", 424);

dimx_end.put("20k", 347);//347
dimy_end.put("20k", 212);//212

dimx_end.put("25k", 162); 
dimy_end.put("25k", 106); 

dimx_end.put("50k", 83);
dimy_end.put("50k", 56);

dimx_end.put("100k", 34); //34
dimy_end.put("100k", 21); //21


dimx_end.put("200k", 17); 
dimy_end.put("200k", 10); 


origin.put("10k", new Origin("10k"  , 281, 265,  63, 159, 2.5));
origin.put("20k", new Origin("20k"  , 140, 132, 159, 208, 5));
origin.put("25k", new Origin("25k"  ,  70,  66,  79, 103, 10 ));
origin.put("50k", new Origin("50k"  ,  35,  33,  40,  52, 20));//org  40,  52=(255-203), //correction=34,  35
origin.put("100k", new Origin("100k",  14,  13,  71,  15, 50)); //org pixy=71=(255-184) pixx=15
origin.put("200k", new Origin("200k",  7,  6,  8, (255-92), 100));



}

public static String intToString(int i){
	if( i<10)
		return "00"+i;
	else if(i<100)
		return "0"+i;
	else
		return i+"";

}

public static String intToLongString(int i){
	//0000011008
	
	String ret;
	if(     Math.abs(i)<10)
		ret = "000000000"+Math.abs(i);
	else if(Math.abs(i)<100)
		ret = "00000000"+Math.abs(i);
	else if(Math.abs(i)<1000)
		ret = "0000000"+Math.abs(i);
	else if(Math.abs(i)<10000)
		ret = "000000"+Math.abs(i);
	else if(Math.abs(i)<100000)
		ret = "00000"+Math.abs(i);
	else if(Math.abs(i)<1000000)
		ret = "0000"+Math.abs(i);
	else if(Math.abs(i)<10000000)
		ret = "000"+Math.abs(i);
	else if(Math.abs(i)<100000000)
		ret = "00"+Math.abs(i);
	else  //(Math.abs(i)<1000000000)
		ret =  "0"+Math.abs(i);
	//else
		//return i+"";
	if (i < 0)
		ret="-"+ret;
	
	return ret;

}
}
